package com.matt.foundation.vo.course;

import com.matt.domain.course.PrepareCourse;
import com.matt.foundation.DO.course.CoursePlanClassesDO;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/3/13
 * *******************************
 */
@Data
public class WebCoursePlanListVo {
    private String classesCoursePlanId;
    private String typeName;
    private String courseName;
    private String classesName;
    private Date courseDate;
    private Date beginTime;
    private Date endTime;
    private Date lastModified;
    private String lastModifiedName;
    private String lastModifiedId;
    private Integer prepareStatus=0;
    private Integer courseStatus=0;
    private Integer category;
    private Integer templateType;
    private Integer typeCode;
    private Integer courseType;
    private String prepareTeacherId;//备课老师ID
    private String prepareTeacherName;//备课老师名称
    private String prepareTeacherImg;//备课老师头像

    public static WebCoursePlanListVo of(CoursePlanClassesDO plan, String classesName, PrepareCourse prepareCourse){
        WebCoursePlanListVo vo = new WebCoursePlanListVo();
        vo.setClassesCoursePlanId(plan.getClassesCoursePlanId());
        vo.setTypeName(plan.getTypeName());
        vo.setCourseName(plan.getCourseName());
        vo.setClassesName(classesName);
        vo.setCourseDate(plan.getCourseDate());
        vo.setBeginTime(plan.getBeginTime());
        vo.setEndTime(plan.getEndTime());
        vo.setCategory(plan.getCategory());
        vo.setTemplateType(plan.getTemplateType());
        if (Objects.nonNull(prepareCourse)){
            vo.setLastModified(prepareCourse.getLastModified());
            vo.setLastModifiedName(prepareCourse.getLastModifiedName());
        }
        vo.setPrepareStatus(plan.getPrepareStatus());
        vo.setCourseStatus(plan.getCourseStatus());
        vo.setCourseType(plan.getCourseType());
        return vo;
    }
}
